<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>radio</title>
    <script type="text/javascript">
        window.onload=function () {
            document.getElementById("browser1").onclick=function () {
                check(this.value);
            }
            document.getElementById("browser2").onclick=function () {
                check(this.value);
            }
            document.getElementById("browser3").onclick=function () {
                check(this.value);
            }
            document.getElementById("browser4").onclick=function () {
                check(this.value);
            }
        }
        function check(browser) {
            document.getElementById("answer").value=browser;
        }
    </script>
</head>
<body>
<label>你喜欢哪种浏览器？</label><br>
<input type="radio" id="browser1" name="browser" value="internet explorer" >
<label>internet explorer</label><br>
<input type="radio" id="browser2" name="browser" value="firefox">
<label>firefox</label><br>
<input type="radio" id="browser3" name="browser" value="chrome">
<label>chrome</label><br>
<input type="radio" id="browser4" name="browser" value="opera">
<label>opera</label><br>
<label>你喜欢的浏览器是：</label>
<input type="text" id="answer" size="16" />
</body>
</html>